
import numpy as np
A= [int(num) for num in input().split()]
B= [int(num) for num in input().split()]
A=np.array(A)
minVAL=np.array([[np.abs(A-b)] for b in B])
print(np.min(minVAL))
# A = [5, 1, 7, 5, 3, 10]
# B = [2, 3, 6, 9]